<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google 地图 API 示例: GGeoXml RSS 叠加层</title>
    <script src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAPTwhF4vlVXrO7ZGOjA9sOxTqQ5WtUwE0C8FR1hRk-yj3qFOmhhR6esbxCerNyfzApAoTJGfOHzcKCQ"
      type="text/javascript"></script>
    <script type="text/javascript"> 
   
    var map;
    var geoXml;
    var toggleState = 1;

	function initialize() {
  	  if (GBrowserIsCompatible()) {
  	    geoXml = new GGeoXml("http://chinamaps.googlecode.com/svn/docs/examples/beijing-resorts.xml");
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(39.917,116.397), 11); 
        map.addControl(new GLargeMapControl());
        map.addOverlay(geoXml);
  	  }
	} 

	function toggleMyKml() {
  	  if (toggleState == 1) {
    	map.removeOverlay(geoXml);
    	toggleState = 0;
  	  } else {
   		map.addOverlay(geoXml);
    	toggleState = 1;
  	  }
	}
    </script>
  </head>

  <body onload="initialize()">

    <div id="map_canvas" style="width: 640px; height: 480px; float:left; border: 1px solid black;"></div>
    </div>
    <br clear="all"/>
    <br/>
    <input type="button" value="切换标记" onClick="toggleMyKml();"/>
    <br/>
  </body>

</html>

